#ifndef __BSP_ADC_H_
#define __BSP_ADC_H_

#include "main.h"
#include "stdio.h"
#include "stdint.h"

#define TEMP1       1
#define TEMP2       2
#define TEMP3       3
#define TEMP4       4
#define TEMP5       5
#define TEMP6       6
#define TEMP7       7

#define BAT_CURRENT1    1
#define BAT_CURRENT2    2


#define ADC_NTC0_VOLTAGE                          0
#define ADC_NTC1_VOLTAGE                          1
#define ADC_NTC2_VOLTAGE                          2
#define ADC_NTC3_VOLTAGE                          3
#define ADC_BUS_CURRENT1                          4
#define ADC_BUS_CURRENT2                          5
#define ADC_VIN_CAPTURE                           6
#define ADC_BAT_VOLTAGE_SENSE                     7
#define ADC_NTC4_VOLTAGE                          8
#define ADC_NTC5_VOLTAGE                          9
#define ADC_NTC6_VOLTAGE                          10
#define ADC_NTC7_VOLTAGE                          11


#define ADC_NTC0_VOLTAGE_INDEX                          0
#define ADC_NTC1_VOLTAGE_INDEX                          1
#define ADC_NTC2_VOLTAGE_INDEX                          2
#define ADC_NTC3_VOLTAGE_INDEX                          3
#define ADC_BUS_CURRENT1_INDEX                          4
#define ADC_BUS_CURRENT2_INDEX                          5
#define ADC_VIN_CAPTURE_INDEX                           6
#define ADC_BAT_VOLTAGE_SENSE_INDEX                     7
#define ADC_NTC4_VOLTAGE_INDEX                          8
#define ADC_NTC5_VOLTAGE_INDEX                          9
#define ADC_NTC6_VOLTAGE_INDEX                          10
#define ADC_NTC7_VOLTAGE_INDEX                          11

uint8_t bsp_adc_init(void);
uint8_t bsp_adc_start(void);

void adc_filter(void);

int32_t bsp_get_bat_curr(uint8_t channel);
uint32_t bsp_get_bat_vol(void);
int32_t bsp_get_vin_vol(void);
int16_t bsp_get_temp_in_board(void);
int16_t bsp_get_temp_by_channel(uint8_t channel);

#endif

